package com.qfedu.mavenk.ioc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author:huayuzhuo
 * @email:2798866329@qq.com
 * @desc: 测试bean生命周期
 * @datatime: 2022/10/20 8:42
 */
public class App03 {

    public void init(){
        System.out.println("初始化");
    }

    public void close(){
        System.out.println("销毁");
    }

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-context.xml");
        App03 app03 = (App03) context.getBean("app03");
        ((ClassPathXmlApplicationContext)context).close();
    }
}
